﻿{strip}

<form id="ClassTemplatesSortForm_{$class.class_id}" onsubmit="return false;">

	<input type="hidden" name="project_id" value="{$project_id}" />
	<input type="hidden" name="class_id" value="{$class.class_id}" />
	<table border="0">
	<tr>
		<th>Name</th>
		<th>Datei</th>
		<th>zuweisen</th>
		<th>standard</th>
	</tr>
	{foreach name="tplloop" from=$templates item=tpl}
		<tr>
			<td><input type="text" name="tpl_name[{$tpl.tpl_id}]" value="{$tpl.tpl_name}" style="width:100px;" /></td>
			<td>{$tpl.tpl_file}</td>
			<td align="center"><input type="checkbox" name="templates[]" value="{$tpl.tpl_id}" {if $class.class_id == $tpl.tpl_class_key_class_id} checked="checked"{/if} /></td>
			<td align="center"><input type="radio" name="tpl_default" value="{$tpl.tpl_id}" {if 1 == $tpl.tpl_class_default && $class.class_id == $tpl.tpl_class_key_class_id} checked="checked"{/if} /></td>
		</tr>
	{/foreach}
	</table>

	<input type="checkbox" value="1" name="override_standard_tpl" /> <label for="override_standard_tpl">Alle Templatezuweisungen mit dem Standard-Template überschreiben</label>
	<br />
	<input type="submit" value="speichern" onclick="{strip}{literal}
		xajax.request(
		{
			ccdsclass:'ccdsClassEditor',
			ccdsfun:'ClassEditorTemplatesAssignmentSave'
		},
		{
			{/literal}
			parameters:[xajax.getFormValues('ClassTemplatesSortForm_{$class.class_id}')]
			{literal}
		}
		);
	{/literal}{/strip}" />


</form>
<br /><br />
<form id="ClassTemplatesaddForm_{$class.class_id}" action="" onsubmit="return false;">
<input type="hidden" name="project_id" value="{$project_id}" />
<input type="hidden" name="class_id" value="{$class.class_id}" />

<input type="button" onclick="{strip}{literal}
CMS.FileManager.open(
{{/literal}
	root:'extensions',project_id:'{$project_id}',
	returnfield: {literal}{{/literal}
		file:xajax.$('class_{$class.class_id}_tpl_file'),
		dir:xajax.$('class_{$class.class_id}_tpl_dir'),
		name:xajax.$('class_{$class.class_id}_tpl_file'),
		type:'tpl',
		container:xajax.$('class_{$class.class_id}_tpl_append')
	{literal}}{/literal},
	callback:{literal}{{/literal}
		ccdsfun:'ClassEditorReturnTemplates',
		ccdsclass:'ccdsClassEditor'
{literal}}});
{/literal}{/strip}" value="neues Template hinzufügen" />
<br />
<br />
<div id="class_{$class.class_id}_tpl_append"></div>

 <br />
<input type="button" value="templates speichern" onclick="{strip}{literal}
xajax.request(
{
	ccdsfun:'ClassEditorTemplatesSave',
	ccdsclass:'ccdsClassEditor'
},
	{{/literal}
		parameters:[xajax.getFormValues('ClassTemplatesaddForm_{$class.class_id}')]
	{literal}	}
);
{/literal}{/strip}" />
</form>
{/strip}